<template>
<div class="container" v-title data-title="充值历史">
    <div class="contSingleList">
        <Vscroll :on-refresh="onRefresh" :on-infinite="onInfinite" :dataList="scrollData">
            <ul class="listItem">
                <!-- <li v-for="(item,index) in listdata">
                    <span>{{ item.date }}</span>
                    <span>{{ item.portfolio }}</span>
                    <span :class="{'state0':(item.state===0),'state1':(item.state==1),state2:(item.state===2)}"  >{{ item.drop }}</span>
                </li> -->
                <!-- <li v-for="(item,index) in listdata">
                    <p class="time-money">{{item.createTime}}<span class="right-money">￥{{item.cashFee}}</span></p>
                    <p class="origin"><i></i>{{item.startGridName}}</p>
                    <p class="destination"><i></i>{{item.endGridName}} <span class="right-state">进行中</span></p>
                </li> -->
                <li class="clearfix" v-for="(item,index) in listdata">
                    <div class="left-box">
                        <p class="text1">{{item.thirdChannel==1?'支付宝':'微信充值'}}</p>
                        <p class="text2">{{item.opTime}}</p>
                    </div>
                    <div class="right-box">
                        <p>{{item.amount}}</p>
                    </div>
                </li>
            </ul>
        </Vscroll>
    </div>
    <simplert ref="simplert"></simplert>
    
</div>
</template>
<script>
// 
    import Vscroll from '../../components/pull-refresh/pull-refresh.vue';

    import Simplert from '../../components/dialog/dialog.vue';

    console.log(Vscroll);
    export default {
        data() {
            return {
                pages:7, //当前页
                num: 10, // 一页显示多少条
                pageStart: 0, // 开始页数
                pageEnd: 0, // 结束页数
                listdata: [], // 下拉更新数据存放数组
                scrollData: {
                    noFlag: false //暂无更多数据显示
                },
                state:true
            }
        },
        components: {
           Vscroll,
           Simplert
        //    Loading
        },
        mounted: function() {
            
            let that = this;
            // 获取token
            // this.$util.getUserToken().then(token=>{
            //     that.token = token;
            // })
        this.getList();
        },
        methods: {
            open (title, message, type) {
                let obj = {
                title: title,
                message: message,
                type: type
                }
                this.$refs.simplert.openSimplert(obj)
            },
            getList() {
                const that = this;
                let more = this.$el.querySelector('.load-more')
                if(this.state){

                    that.$api.post('/journal/v1/authApi/history',{},s=>{
                        let data= s.module;
                        //     var listdata=[];
                        //    for(var i=0;i<20;i++){
                        //         listdata.push(data[0]);
                        //     }
                        //     console.log(data[0])
                        //     this.listdata = listdata;
                        this.listdata = data;
                        
                    },f=>{
                        that.open('列表获取失败',false,'','','fade_alert',function(){});
                    },{
                        'requestPlatform': that.wx_app,
                        'token': 'eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzZWNhciIsImFwcGtleSI6IjE3NjAyMTE4ODY5Iiwic2VjcmV0IjoiMmJmMmQ3MDkyZGFkNTFhMzI0ZTk0YWQwN2Q2ODJkZjQifQ.Ux0IFWSJK0lOrVNUc0Yd6X41rqVS7uJXxMciPOy4rmw'
                    })
                }else{
                    more.style.display = 'none';
                    that.scrollData.noFlag = true;
                }
            },
            onRefresh(done) {
                this.pages = 1;
                this.getList();

                done(); // call done 

            },
            onInfinite(done) {
                this.pages++;
                this.getList();
                done();
            }

        }
    }
</script>
<style>
 html,body{
        height:100%;
    }
</style>

<style scoped>
  @import "../styles/styles.css";
    .contSingleList{
        width:100%;
        height:100%;
    }
    .listItem{
        overflow-y: auto;
        width:100%;
        margin:0;
        padding:0;
    }
    .listItem li{
        height:1.54rem;
        margin:0 0.43rem;
        border-bottom:1px solid #ededed;
    }
    .listItem li .left-box,.listItem li .right-box{
        float:left;
        width:50%;
        height:0.73rem;
        margin-top:0.41rem;
        /* border:1px solid red; */
    }
    .text1{
        font:0.28rem/0.41rem "Microsotf Yahei";
        color:#333;
    }
    .text2{
        font:0.24rem/0.32rem "Microsotf Yahei";
        color:#666;
    }
    .listItem li .right-box{
        text-align:right;
        font:0.28rem/0.73rem "Microsotf Yahei";
        color:#ff5d2e;
    }
</style>
